﻿using System.Data.Services.Common;
using System.Linq;
using BookStoreService.Core.Repository;

namespace BookStoreService.Core.Models
{
    public class UserList
    {
        private readonly IRepository<User> m_repository;

        public UserList(IRepository<User> repository)
        {
            m_repository = repository;
        }

        public IQueryable<User> Users
        {
            get { return m_repository.Query(); }
        }


        public void Add(User book)
        {
            m_repository.Add(book);
        }

        public void SubmitChanges()
        {
            m_repository.SubmitChanges();
        }
    }

    [DataServiceKey("Name")]
    public class User
    {
        public User()
        {
        }

        public User(string name)
        {
            Name = name;
        }

        public string Name { get; set; }


    }
}
